package part06_装饰者模式;

/**
 * @ClassName: Decorator
 * @Author: AllenSun
 * @Date: 2020/3/1 17:51
 */
public class Decorator extends Drink {
    private Drink obj;
    public Decorator(Drink obj){
        this.obj=obj;
    }
    @Override
    public float cost() {
        //getPrice是自己价格
        return super.getPrice()+obj.cost();
    }

    @Override
    public String getDescription() {
        //装饰者的藐视+装饰者的价格+被装饰者的描述
        return super.getDescription() + " "+ super.getPrice() +" "+ obj.getDescription();
    }
}
